<?php
/**
 * SBBudgetRuleDetails
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Sponsored Brands campaign management
 *
 * Create and manage Sponsored Brands campaigns.   To learn more about Sponsored Brands campaigns, see:   - [Sponsored Brands overview](guides/sponsored-brands/overview)  - [Sponsored Brands campaign structure](guides/sponsored-brands/campaigns/structure)  - [Get started with Sponsored Brands campaigns](guides/sponsored-brands/campaigns/get-started-with-campaigns)
 *
 * OpenAPI spec version: 4.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * SBBudgetRuleDetails Class Doc Comment
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class SBBudgetRuleDetails implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'SBBudgetRuleDetails';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'duration' => '\AmazonAdvertisingApi\Model\RuleDuration',
        'recurrence' => '\AmazonAdvertisingApi\Model\Recurrence',
        'rule_type' => '\AmazonAdvertisingApi\Model\SBRuleType',
        'budget_increase_by' => '\AmazonAdvertisingApi\Model\BudgetIncreaseBy',
        'name' => 'string',
        'performance_measure_condition' => '\AmazonAdvertisingApi\Model\PerformanceMeasureConditionForSB'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'duration' => null,
        'recurrence' => null,
        'rule_type' => null,
        'budget_increase_by' => null,
        'name' => null,
        'performance_measure_condition' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'duration' => 'duration',
        'recurrence' => 'recurrence',
        'rule_type' => 'ruleType',
        'budget_increase_by' => 'budgetIncreaseBy',
        'name' => 'name',
        'performance_measure_condition' => 'performanceMeasureCondition'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'duration' => 'setDuration',
        'recurrence' => 'setRecurrence',
        'rule_type' => 'setRuleType',
        'budget_increase_by' => 'setBudgetIncreaseBy',
        'name' => 'setName',
        'performance_measure_condition' => 'setPerformanceMeasureCondition'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'duration' => 'getDuration',
        'recurrence' => 'getRecurrence',
        'rule_type' => 'getRuleType',
        'budget_increase_by' => 'getBudgetIncreaseBy',
        'name' => 'getName',
        'performance_measure_condition' => 'getPerformanceMeasureCondition'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }



    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['duration'] = isset($data['duration']) ? $data['duration'] : null;
        $this->container['recurrence'] = isset($data['recurrence']) ? $data['recurrence'] : null;
        $this->container['rule_type'] = isset($data['rule_type']) ? $data['rule_type'] : null;
        $this->container['budget_increase_by'] = isset($data['budget_increase_by']) ? $data['budget_increase_by'] : null;
        $this->container['name'] = isset($data['name']) ? $data['name'] : null;
        $this->container['performance_measure_condition'] = isset($data['performance_measure_condition']) ? $data['performance_measure_condition'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets duration
     *
     * @return \AmazonAdvertisingApi\Model\RuleDuration
     */
    public function getDuration()
    {
        return $this->container['duration'];
    }

    /**
     * Sets duration
     *
     * @param \AmazonAdvertisingApi\Model\RuleDuration $duration duration
     *
     * @return $this
     */
    public function setDuration($duration)
    {
        $this->container['duration'] = $duration;

        return $this;
    }

    /**
     * Gets recurrence
     *
     * @return \AmazonAdvertisingApi\Model\Recurrence
     */
    public function getRecurrence()
    {
        return $this->container['recurrence'];
    }

    /**
     * Sets recurrence
     *
     * @param \AmazonAdvertisingApi\Model\Recurrence $recurrence recurrence
     *
     * @return $this
     */
    public function setRecurrence($recurrence)
    {
        $this->container['recurrence'] = $recurrence;

        return $this;
    }

    /**
     * Gets rule_type
     *
     * @return \AmazonAdvertisingApi\Model\SBRuleType
     */
    public function getRuleType()
    {
        return $this->container['rule_type'];
    }

    /**
     * Sets rule_type
     *
     * @param \AmazonAdvertisingApi\Model\SBRuleType $rule_type rule_type
     *
     * @return $this
     */
    public function setRuleType($rule_type)
    {
        $this->container['rule_type'] = $rule_type;

        return $this;
    }

    /**
     * Gets budget_increase_by
     *
     * @return \AmazonAdvertisingApi\Model\BudgetIncreaseBy
     */
    public function getBudgetIncreaseBy()
    {
        return $this->container['budget_increase_by'];
    }

    /**
     * Sets budget_increase_by
     *
     * @param \AmazonAdvertisingApi\Model\BudgetIncreaseBy $budget_increase_by budget_increase_by
     *
     * @return $this
     */
    public function setBudgetIncreaseBy($budget_increase_by)
    {
        $this->container['budget_increase_by'] = $budget_increase_by;

        return $this;
    }

    /**
     * Gets name
     *
     * @return string
     */
    public function getName()
    {
        return $this->container['name'];
    }

    /**
     * Sets name
     *
     * @param string $name The budget rule name. Required to be unique within a campaign.
     *
     * @return $this
     */
    public function setName($name)
    {
        $this->container['name'] = $name;

        return $this;
    }

    /**
     * Gets performance_measure_condition
     *
     * @return \AmazonAdvertisingApi\Model\PerformanceMeasureConditionForSB
     */
    public function getPerformanceMeasureCondition()
    {
        return $this->container['performance_measure_condition'];
    }

    /**
     * Sets performance_measure_condition
     *
     * @param \AmazonAdvertisingApi\Model\PerformanceMeasureConditionForSB $performance_measure_condition performance_measure_condition
     *
     * @return $this
     */
    public function setPerformanceMeasureCondition($performance_measure_condition)
    {
        $this->container['performance_measure_condition'] = $performance_measure_condition;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
